<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app"></div>
    <script type="text/javascript" src="../js/react.development.js"></script>
    <script type="text/javascript" src="../js/react-dom.development.js"></script>
    <script type="text/javascript" src="../js/babel.min.js"></script>
    <script type="text/babel">
    class Weather extends React. Component {
        // 有状态的组件
        constructor(props) {
            super(props);
            // 初始化状态
            this.state = {
                isHot: true,
            }
        }
        render() {
            this.changeWeather()
            // 读取状态
            return <h1 onClick={this.changeWeather.bind(this)}>今天天气{this.state.isHot?'热': '凉'}</h1>
        }
        changeWeather() {
            console.log('22',this)
            this.state.isHot = false;
        }
    }
    ReactDOM.render(<Weather />, document.getElementById('app'))
    </script>

</body>
</html>